class Solution:
    def Merge(self, pHead1: ListNode, pHead2: ListNode) -> ListNode:
        if pHead1 is None:
            return pHead2
        if pHead2 is None:
            return pHead1

        if pHead1.val > pHead2.val:
            pHead2.next = self.Merge(pHead1, pHead2.next)
            return pHead2
        else:
            pHead1.next = self.Merge(pHead2, pHead1.next)
            return pHead1